package com.briup.day14.bean;

/**
 * @author ThinkBook
 */
//结论1：包含抽象方法的类，一定是抽象类
public abstract class Animal {
    //抽象类可以包含数据成员
    private String color;
    private int age;

    //构造方法
    public Animal() {
    }
    public Animal(String color, int age) {
        this.color = color;
        this.age = age;
    }

    //get|set方法
    public String getColor() {
        return color;
    }
    public int getAge() {
        return age;
    }

    //重写toString
    @Override
    public String toString() {
        return "Animal{" +
                "color='" + color + '\'' +
                ", age=" + age +
                '}';
    }

    //抽修方法
    public abstract void eat();
    public abstract void sleep();
}
